<template>
  <div class="app-container home">
    <!-- 顶部布局 -->
    <img class="top-title-img" src="@/assets/images/home/title.gif" alt="" />
    <div class="top-title">{{ title }}“筑基行动”挂图作战 {{ todayTime }}</div>
    <div class="top-layout layout">
      <HomeTask />
    </div>
    <div class="main-layout">
      <!-- 左侧布局 营销业务统计-->
      <div class="left-layout layout">
        <HomeLeft />
      </div>
      <!-- 中间布局 -->
      <div class="center-layout">
        <!-- 中间布局顶部 地图-->
        <div class="center-layout-top layout">
          <HomeBottom />
        </div>
        <!-- 中间布局中间 营业部包区业务统计-->
        <div class="center-layout-center layout">
          <HomeRight />
        </div>
      </div>
      <!-- 右侧布局 小区业务数据统计排名-->
      <div class="right-layout layout">
        <div class="right-layout-top">
          <HomeCenter />
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import Title from "./components/Title";
import HomeTask from "./components/HomeTask";
import HomeCenter from "./components/HomeCenter";
import HomeLeft from "./components/HomeLeft";
import HomeRight from "./components/HomeRight";
import HomeBottom from "./components/HomeBottom";
import { getDeptTree } from "@/api/system/user";
import store from "@/store";

let baseUrl =
  location.protocol +
  "//" +
  location.hostname +
  (location.port ? ":" + location.port : "");
export default {
  name: "Index",
  components: {
    Title,
    HomeTask,
    HomeCenter,
    HomeLeft,
    HomeRight,
    HomeBottom,
  },
  data() {
    return {
      title: "十里店营业部",
      // deptId: 219,
      deptId: store.state.user.deptId, //将缓存的用户id赋值给userId，用于查询营销人员
      todayTime: "",
    };
  },
  mounted() {
    //this.autoScroll();
    this.getDeptTree();
    this.getTodayTime();
  },
  methods: {
    getTodayTime() {
      var date = new Date();
      var year = date.getFullYear(); // 年份
      var month = date.getMonth() + 1; // 月份，返回值为0-11，所以需要加1
      var day = date.getDate(); // 日期

      // 对月份和日期进行补零
      month = month < 10 ? "0" + month : month.toString();
      day = day < 10 ? "0" + day : day.toString();

      this.todayTime = year + "/" + month + "/" + day;
    },
    getDeptTree() {
      getDeptTree({ deptId: this.deptId }).then((res) => {
        // console.log(res,'44444444444444444');
        this.title = res.data.deptName;
        // this.deptTree = res.data;
      });
    },
  },
};
</script>

<style scoped lang="scss">
.app-container {
  padding: 10px;
}

.home {
  width: 100%;
  height: calc(90vh);
  // background: rgba(243, 242, 239, 1);
  background: url(../assets/images/home/bg.jpg) no-repeat center center;
  background-size: 100% 100%;
  position: relative;
  display: flex;
  justify-content: space-between;
  flex-direction: column;

  .layout {
    width: 100%;
    // background: #fff;
    // border: 1px solid #ccc;
    background: url(../assets/images/home/preview.png) no-repeat center center;
    background-size: 100% 100%;
    box-sizing: border-box;
    border-radius: 4px;
    padding: 10px 18px;
    box-sizing: border-box;
    // .wrapper-right:nth-child(2) {
    //   background: url(../assets/images/home/preview.png) no-repeat center center;
    //   background-size: 100% 100%;
    // }
  }
  .top-title-img {
    width: 100%;
    height: auto;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 0;
  }
  .top-title {
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 24px;
    font-weight: 600;
    color: #409eff;
    height: auto;
    letter-spacing: 2px;
    position: relative;
    z-index: 1;
    font-family: PangMenZhengDao;
    writing-mode: horizontal-tb;
    filter: drop-shadow(rgba(0, 11, 27, 0.66) 1px 1px 6px)
      drop-shadow(rgb(95, 159, 255) 2px 1px 8px);
    color: rgb(255, 255, 255);
    word-spacing: 0px;
    letter-spacing: 4px;
    text-orientation: upright;
    user-select: text;
  }

  .top-layout {
    width: 100%;
    height: 14%;
    //margin-bottom: 16px;
  }

  .main-layout {
    width: 100%;
    height: 79%;
    /* // flex-grow: 1; */
    display: flex;
    justify-content: space-between;
    flex-direction: row;

    // .filtr-selects {
    //   display: flex;
    //   justify-content: end;
    // }

    .left-layout {
      width: 35%;

      // .bar-svg {
      //   height: calc(100% - 75px);
      //   display: flex;
      //   flex-direction: column;
      //   justify-content: space-around;

      //   .bar-svg-item {
      //     margin-top: 8px;
      //     border-bottom: 2px solid rgba(0, 0, 0, 0.4);

      //     .bar-svg-item-title {
      //       font-size: 18px;
      //       color: #aeaeb2;
      //     }

      //     .bar-svg-item-num {
      //       display: flex;
      //       font-size: 28px;
      //       line-height: 35px;
      //       color: #000;
      //       font-weight: 600;
      //     }
      //   }
      // }
    }

    .center-layout {
      width: 36%;
      display: flex;
      flex-direction: column;
      justify-content: space-between;

      .center-layout-top {
        height: 49%;

        .map-img {
          width: 100%;
          height: 100%;
        }
      }

      .center-layout-center {
        height: 49%;
        position: relative;
      }

      .center-layout-bottom {
        position: relative;
        height: 26%;

        .filter-selects-bottom {
          position: absolute;
          top: 6px;
          right: 20px;
          width: 36%;

          .bottom-selects {
            width: 25%;
          }
        }
      }
    }

    .right-layout {
      width: 28%;
      height: 100%;
      display: flex;
      flex-direction: column;
      justify-content: space-between;

      .right-layout-top {
        position: relative;
        height: 100%;
      }

      .right-layout-center {
        height: 10%;
      }

      .right-layout-bottom {
        height: 35%;
      }
    }
  }
}

::v-deep .el-table tr {
  background-color: #ecf5ff;
}
::v-deep .el-table {
  background-color: #ecf5ff;
}

::v-deep .el-slider__runway.disabled .el-slider__bar {
  background-color: #3e7af6 !important;
  cursor: default !important;
}

::v-deep .el-slider__runway.disabled .el-slider__button {
  border-color: #3e7af6 !important;
  cursor: pointer !important;
}

::v-deep .el-slider__runway.disabled .el-slider__button-wrapper:hover,
.el-slider__runway.disabled .el-slider__button-wrapper.hover {
  cursor: default !important;
}

::v-deep .el-select .el-input .el-select__caret {
  width: 12px;
}

::v-deep .el-input--suffix .el-input__inner {
  padding-right: 15px;
}

::v-deep .el-date-editor--daterange.el-input__inner {
  width: 226px;
}

::v-deep .el-image__inner.el-image__preview {
  object-fit: inherit !important;
}

::v-deep .el-table__cell {
  color: #000000; /* 设置字体颜色为绿色 */
  /* font-weight: 700; */
}
::v-deep .bar-svg-item-title {
  color: #3dc8fd !important;
}

::v-deep .bar-svg-item-num {
  color: #fff !important;
}
::v-deep .el-progress--circle .el-progress__text {
  color: #fff !important;
}
::v-deep .el-table,
::v-deep .el-table tr {
  background: transparent !important;
  color: #fff !important;
}
::v-deep
  .el-table--enable-row-hover
  ::v-deep
  .el-table__body
  tr:hover
  > td.el-table__cell {
  background: transparent !important;
}
::v-deep .el-table__cell {
  color: #fff !important;
}
::v-deep .el-table thead.is-group th.el-table__cell {
  background: transparent !important;
}
::v-deep .el-table .el-table__header-wrapper th,
::v-deep .el-table .el-table__fixed-header-wrapper th {
  background: transparent !important;
  color: #3dc8fd !important;
}
::v-deep .el-table th.el-table__cell.is-leaf,
::v-deep .el-table td.el-table__cell {
  border-bottom: 1px solid rgb(223 230 236 / 10%);
}
::v-deep .el-table--border .el-table__cell {
  border-right: 1px solid rgb(223 230 236 / 10%);
}
::v-deep .el-table--border th.el-table__cell {
  border-bottom: 1px solid rgb(223 230 236 / 10%);
}
::v-deep .el-table--group,
::v-deep .el-table--border {
  border: 1px solid rgb(223 230 236 / 10%);
}
::v-deep .el-table--enable-row-hover .el-table__body tr:hover > td {
  background-color: #212e3e !important;
}
::v-deep .el-table th.gutter {
  display: none;
  width: 0;
}
::v-deep .el-table colgroup col[name="gutter"] {
  display: none;
  width: 0;
}
// 去除table表格顶部的白线
::v-deep .el-table th.el-table__cell.is-leaf {
  border: 1px solid rgb(223 230 236 / 10%);
}
// 去除table表格底部白色线条
::v-deep .el-table::before,
::v-deep .el-table--group::after,
::v-deep .el-table--border::after {
  background-color: transparent;
}
::v-deep .title{
  color: #fff;
}
</style>